//
//  OTDR_TestDetailInfoCell.m
//  OTDR
//
//  Created by Liu on 2024/6/17.
//

#import "OTDR_TestDetailInfoCell.h"

@implementation OTDR_TestDetailInfoCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = kWhiteColor;
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    //内容区最大宽度
    CGFloat contentWidth = SCREEN_HEIGHT-[UIApplication sharedApplication].keyWindow.safeAreaInsets.top-[UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom-SIZE(20);
    UIView *view =  [ViewCreate createLineFrame:CGRectMake(0, 0, contentWidth, SIZE(45)) backgroundColor:[UIColor whiteColor]];
    [self.contentView addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_offset(0);
    }];
    //1、2区域宽度
    CGFloat widthAB = SIZE(45);
    CGFloat otherWidth = (contentWidth-SIZE(45)*2)/5.0;
    
    self.la1 = [ViewCreate createLabelFrame:CGRectMake(0, 0, widthAB, widthAB) backgroundColor:kWhiteColor text:@"" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la1];
    
    self.la2 = [ViewCreate createImageViewFrame:CGRectMake(widthAB+5, 5, widthAB-10, widthAB-10) image:@"eventend"];
    [view addSubview:self.la2];
    
    self.la3 = [ViewCreate createLabelFrame:CGRectMake(widthAB*2, 0, otherWidth, widthAB) backgroundColor:kWhiteColor text:@"0.000" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la3];
    [self.la3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.la2.mas_right).mas_offset(5);
        make.height.mas_offset(widthAB);
        make.centerY.mas_equalTo(self.la2.mas_centerY).mas_offset(0);
    }];
    
    self.la4 = [ViewCreate createLabelFrame:CGRectMake(widthAB*2+otherWidth, 0, otherWidth, widthAB) backgroundColor:kWhiteColor text:@"-----" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la4];
    [self.la4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.la3.mas_right).mas_offset(0);
        make.height.mas_offset(widthAB);
        make.centerY.mas_equalTo(self.la2.mas_centerY).mas_offset(0);
        make.width.mas_equalTo(self.la3.mas_width).mas_offset(0);
    }];
    
    self.la5 = [ViewCreate createLabelFrame:CGRectMake(widthAB*2+otherWidth*2, 0, otherWidth, widthAB) backgroundColor:kWhiteColor text:@"-----" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la5];
    [self.la5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.la4.mas_right).mas_offset(0);
        make.height.mas_offset(widthAB);
        make.centerY.mas_equalTo(self.la2.mas_centerY).mas_offset(0);
        make.width.mas_equalTo(self.la4.mas_width).mas_offset(0);
    }];
    
    self.la6 = [ViewCreate createLabelFrame:CGRectMake(widthAB*2+otherWidth*3, 0, otherWidth, widthAB) backgroundColor:kWhiteColor text:@"-----" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la6];
    [self.la6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.la5.mas_right).mas_offset(0);
        make.height.mas_offset(widthAB);
        make.centerY.mas_equalTo(self.la2.mas_centerY).mas_offset(0);
        make.width.mas_equalTo(self.la5.mas_width).mas_offset(0);
    }];
    
    self.la7 = [ViewCreate createLabelFrame:CGRectMake(widthAB*2+otherWidth*4, 0, otherWidth, widthAB) backgroundColor:kWhiteColor text:@"0.000" textColor:RGB51 textAlignment:Center font:FONT(17)];
    [view addSubview:self.la7];
    [self.la7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.la6.mas_right).mas_offset(0);
        make.height.mas_offset(widthAB);
        make.centerY.mas_equalTo(self.la2.mas_centerY).mas_offset(0);
        make.right.mas_equalTo(view.mas_right).mas_offset(0);
        make.width.mas_equalTo(self.la6.mas_width).mas_offset(0);
    }];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
